<template>
    <el-container>
        <div style="padding: 10px;padding-bottom: 0">
            <div class="report_header" ref="headerHeight">
                <div style="display: flex;align-items: center;justify-content: space-between">
                    <div class="report_header_left"></div>
                    <div style="display: flex;align-items: center;">
                        <div class="report_header_date">
                            <el-date-picker v-model="keyword.date" value-format="yyyy-MM-dd" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions">
                            </el-date-picker>
                        </div>
                    </div>
                    <div style="display: flex;flex-direction: row;justify-content: flex-end;">
                        <div style="display: flex;flex-direction: row;flex-wrap: wrap;overflow: hidden;height:41px;justify-content: flex-end;">
                        </div>
                        <el-button style="margin-left: 10px;margin-top: 7px;height: 100%" size="small" type="primary" @click="listclick">查询</el-button>
                    </div>
                </div>
                <div style="width: 800px;display: flex;align-items: center;" v-show="queryType == true">
                    <!--          这是放隐藏条件的容器-->
                </div>
            </div>
        </div>
        <div class="pd10">
            <el-tabs type="border-card" v-model="activeName" @tab-click="tabsClick">
                <el-tab-pane label="全部订单" name=" ">
                    <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm" @detailsClick='detailsClick'></snapList>
                    </div>
                </el-tab-pane>
            <el-tab-pane label="未上架" name="0" >
                     <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm" @detailsClick="detailsClick"></snapList>
                    </div>
            </el-tab-pane>
            <el-tab-pane label="已上架" name="1">
                    <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm"  @detailsClick="detailsClick"></snapList>
                    </div>
            </el-tab-pane>
            <el-tab-pane label="待付款" name="2">
                    <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm"  @detailsClick="detailsClick"></snapList>
                    </div>
            </el-tab-pane>
                <el-tab-pane label="已付款" name="3">
                    <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm"  @detailsClick="detailsClick"></snapList>
                    </div>
            </el-tab-pane>
                <el-tab-pane label="已流拍" name="4">
                    <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm"  @detailsClick="detailsClick"></snapList>
                    </div>
            </el-tab-pane>
                <el-tab-pane label="申诉中" name="5">
                    <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm"  @detailsClick="detailsClick"></snapList>
                    </div>
            </el-tab-pane>
                <el-tab-pane label="已转让" name="6">
                    <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm"  @detailsClick="detailsClick"></snapList>
                    </div>
            </el-tab-pane>
                <el-tab-pane label="已提货" name="7">
                    <div class="details_card" v-loadMore="[payLoads,'shipping-list3']" :style="{height:tabsHeight+'px'}">
                        <snapList :snaporderForm="snaporderForm"  @detailsClick="detailsClick"></snapList>
                    </div>
            </el-tab-pane>

            </el-tabs>
        </div>

        <el-footer class="el-footerBox" style="margin-bottom: auto">
            <pagination :total="total" :page.sync="pageNum" :limit.sync="pageSize" @pagination="listclick"></pagination>
        </el-footer>
    </el-container>
</template>
<script>
import loadMore from "@/utils/more.js";
import {list} from '@/api/auctionOrder';
import snapList from './components/snaplist'
import Pagination from '@/components/Pagination'
export default {
    name: "snaporder-list",
    directives: { loadMore },
    activated() {
        this.payLoads = new Date().getTime();
    },
    data() {
        return {
            snaporderForm:[],
            keyword: {date: "",status:""},
            queryType: true,
            pageNum:1,
            pageSize:20,
            total:0,
            payLoads: "",
            activeName: " ",
            pickerOptions: {
                //时间快捷选择
                shortcuts: [
                    {
                        text: "昨天",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24);
                            picker.$emit("pick", [start, end]);
                        },
                    },
                    {
                        text: "最近一周",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 7
                            );
                            picker.$emit("pick", [start, end]);
                        },
                    },
                    {
                        text: "最近一个月",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 30
                            );
                            picker.$emit("pick", [start, end]);
                        },
                    },
                    {
                        text: "最近三个月",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 90
                            );
                            picker.$emit("pick", [start, end]);
                        },
                    },
                ],
            },
        };
    },
    components: {
        snapList,
        Pagination
    },
    computed: {},
    created() {
        this.listclick()
        this.comeIn();
        this.beforeMount();
    },
    mounted() {},
    beforeDestroy() {},
    methods: {
        detailsClick(data){
            console.log(data)
            this.$router.push({path:'/snaporder/view',query:{id:data}})
        },
        tabsClick(data) {
            this.keyword.status=data.name
            this.listclick()
        },
        listclick(){
        var _this = this
        let params = new URLSearchParams()
        params.append('pageNum', _this.pageNum)
        params.append('pageSize', _this.pageSize)
        params.append('startDate', this.keyword.date == null || this.keyword.date.length == 0 ? '' : this.keyword.date[0])
        params.append('endDate', this.keyword.date == null || this.keyword.date.length == 0 ? '' : this.keyword.date[1])
        // params.append('keyword', _this.keyword.information)
        params.append('status', _this.keyword.status)
        list(params).then(response => {
          _this.snaporderForm = response.data.data
          _this.total = response.data.total
        }).catch(error => {
          // console.log('error!!')
        })
        },
        beforeMount() {
            var _this = this;
            window.onresize = () => {
                return (() => {
                    if (_this.queryType == false) {
                        var h =
                            document.documentElement.clientHeight ||
                            document.body.clientHeight;
                        _this.curHeight = h - 311; //减去页面上固定高度height
                        _this.tabsHeight = h - 381;
                    } else {
                        var h =
                            document.documentElement.clientHeight ||
                            document.body.clientHeight;
                        _this.curHeight = h - 224; //减去页面上固定高度height
                        this.tabsHeight = h - 294;
                    }
                })();
            };
        },
        comeIn() {
            // console.log('222')
            var h =
                document.documentElement.clientHeight ||
                document.body.clientHeight;
            this.curHeight = h - 224; //减去页面上固定高度height
            this.tabsHeight = h - 294;
        },
    },
};
</script>

<style scoped>
.app {
    height: 80px;
    width: 100%;
    display: flex;
    background-color: rgb(233, 235, 236);
}

.deliveryboy {
    height: 100%;
    width: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-right: rgb(245, 247, 250) 1px solid;
}

.content {
    height: 100%;
    width: 700px;
    display: flex;
    justify-content: space-around;
}

.content_one {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.summary {
    height: 100%;
    paddding-top: 40px;
    paddding-left: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    margin-left: 20px;
    border-left: rgb(245, 247, 250) 1px solid;
}

.details_card {
    overflow: auto;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
    border: 1px solid #f2f2f2;
    border-radius: 4px;
}

.elOption {
    background-color: #909399;
    color: white;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50%;
    height: 40px;
}

.details_card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}

.el-input__inner {
    width: 100% !important;
}

.app {
    background-color: rgba(248, 248, 248, 0.8);
}

/deep/ .el-header {
    padding: 10px;
    padding-bottom: 0;
}

.report_header {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    background-color: rgba(248, 248, 248, 0.8);
    display: flex;
    padding-bottom: 5px;
    position: relative;
    padding-left: 5px;
    padding-right: 5px;
    flex-direction: column;
}

.report_header_left {
    width: 5px;
    height: 46px;
    background-color: #409eff;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
}

.report_header_query {
    margin-left: 10px;
    width: 150px;
    margin-top: 5px;
}

.report_header_date {
    margin-left: 10px;
    width: 250px;
    margin-top: 5px;
}
.span-box {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}
.btn-bell-badge {
    width: 26px;
    height: 18px;
    margin-left: 5px;
    line-height: 18px;
    border-radius: 15px;
    background: #ed4014;
}
.num {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 12px;
    color: #fff;
}
.el-tabs__header {
    position: relative;
}
.el-tabs__nav-scroll {
    position: relative;
}
.el-checkbox-refresh {
    position: absolute;
    right: 30px;
    top: 0;
}
</style>





